package cn.hchaojie.camp.day09;

import org.junit.Test;

import cn.hchaojie.camp.day07.Employee;
import cn.hchaojie.camp.day07.Manager;

// 运行时异常
public class DemoRuntimeException {
	public static void main(String[] args) {
		String s = null;
		
		// s是不是null，
		if (s != null) {
			s.charAt(0);
		}
	}
	
	@Test
	public void test2() {
		Employee e = new Employee("Boss", 18);
		
		Manager m = (Manager) e;
	}
	
	// 数组越界
	@Test
	public void test3() {
		int[] array = {2, 3};
		
		System.out.println(array[2]);
	}
	
	// 下标越界
	@Test
	public void test4() {
		String s = "abb";
		
		System.out.println(s.charAt(3));
	}
	
	// 除0异常
	@Test
	public void test5() {
		int j = 0;
		int i = 10 / j;
	}
}
